load(":boost_test_suite.bzl", "boost_test_suite")

boost_test_suite(
    name = "gen_boost.sort_test_targets",
    cc_srcs = glob(
        ["*.cpp"],
        # These tests pass (Boost reports no errors) but fail with a
        # "free(): invalid pointer" error on Ubuntu 24.04 on BCR's CI, but I
        # cannot reproduce this locally, so just exclude for now.
        exclude = [
            "float_sort_test.cpp",
            "test_block_indirect_sort.cpp",
            "test_insert_sort.cpp",
            "integer_sort_test.cpp",
            "sort_detail_test.cpp",
            "test_spinsort.cpp",
            "string_sort_test.cpp",
        ],
    ),
    defines = select({
        "@platforms//os:windows": [
            # MSVC has `and` and `or` preprocessor macros which confuse
            # the compiler when including `and.hpp` and `or.hpp` from `boost.mpl`
            # and end up trying to include `&.hpp` and `||.hpp`.
            "BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS",
        ],
        "//conditions:default": [],
    }),
    deps = [
        "//:boost.sort",
        "@boost.test",
    ],
)
